package com.study.zzedu.ui.evaluate;

import android.content.Context;

import com.study.zzedu.base.BasePresenter;
import com.study.zzedu.base.BaseView;
import com.study.zzedu.http.OnResultListener;

public class EvaluatePresenter extends BasePresenter<EvaluateContract.IView> {

    private EvaluateModel eModel;
    public EvaluatePresenter(){
        this.eModel = new EvaluateModel();
    }

    public void getEvaluateInfoList(Context context){
        eModel.getEvaluateInfoList(context, new OnResultListener() {
            @Override
            public void onSuccess(String result) {
                getView().getEvaluateListData(result);
            }

            @Override
            public void onError(String error) {
                getView().showError(error);
            }
        });
    }
    public void checkUserCourseAssess(Context context,String courseCode){
        eModel.checkUserCourseAssess(context, courseCode,new OnResultListener() {
            @Override
            public void onSuccess(String result) {
                getView().checkUserCourseAssessBack(result);
            }

            @Override
            public void onError(String error) {
                getView().showError(error);
            }
        });
    }
    public void submitData(Context context,String userCode,String courseCode,String subjectCodes,String scores,String content){
        eModel.submitData(context, userCode,courseCode,subjectCodes,scores,content,new OnResultListener() {
            @Override
            public void onSuccess(String result) {
                getView().getSubmitBack(result);
            }

            @Override
            public void onError(String error) {
                getView().showError(error);
            }
        });
    }
}
